//
//  LYThridPartTool.h
//  LYDevelopKit
//
//  Created by 李阳 on 2018/5/28.
//

#import <UIKit/UIKit.h>


/// 第三方平台类型
typedef NS_ENUM(NSUInteger, FTGPlatformType) {
    FTGPlatformFacebook, ///< facebook
    FTGPlatformTwitter, ///< twitter
    FTGPlatformGoogle ///< google
};

///
@interface FTGPlatformResult : NSObject

/// 平台类型
@property (nonatomic, assign, readonly)FTGPlatformType platformType;

@property(nonatomic, copy, readonly)NSString *userId;
@property(nonatomic, copy, readonly)NSString *token;
@property(nonatomic, copy, readonly)NSString *secret;

/// 邮箱
@property (nonatomic, copy, readonly)NSString *email;

/// 头像地址
@property (nonatomic, strong, readonly)NSURL *iconUrl;

@property(nonatomic, copy, readonly)NSString *fullName;
/// 谷歌注册即为firstName
@property(nonatomic, copy, readonly)NSString *firstName;
/// 谷歌注册即为lastName
@property(nonatomic, copy, readonly)NSString *lastName;

@property(nonatomic, copy, readonly)NSDate *expirationDate;
@property(nonatomic, copy, readonly)NSDate *refreshDate;
@property(nonatomic, copy, readonly)NSSet *permissions;

@end

/// 第三方平台工具类 Facebook Twitter Google
@interface FTGPlatformTool : NSObject

+ (instancetype)defaultTool;

#pragma mark - 注入模块
/// 注入谷歌模块
- (void)injectGoolgeModuleWithClientID:(NSString *)clientID;
/// 注入Twitter模块
- (void)injectTwitterLoginWithKey:(NSString *)key
                              secret:(NSString *)secret;

#pragma mark - 启动模块
/// 如果为facebook时 vc不能为nil，其他类型可以为nil
- (void)fireWithPlatformType:(FTGPlatformType)type viewController:(UIViewController *)vc completion:(void(^)(FTGPlatformResult *result, NSError *error))completion;

- (BOOL)facebookDidFinishLaunchingWithApplication:(UIApplication *)app options:(NSDictionary *)options;

- (BOOL)application:(UIApplication *)application
           handleURL:(NSURL *)url
   sourceApplication:(NSString *)sourceApplication
          annotation:(id)annotation;

@end







